package com.aaa.sbm.util;

import com.aaa.sbm.entity.User;

import javax.servlet.http.HttpSession;

/**
 * @FileName: BaseUtil
 * @Description:
 * @Author: 王成林
 * @CreateTime: 2025/7/10 18:28
 * @Version: 1.0.0
 */
public class BaseUtil {
    //  @Resource
    private static HttpSession session;

    /**
     * 静态注入
     * @param session
     */
    public static void setSession(HttpSession session) {
        BaseUtil.session = session;
    }

    /**
     * 获取用户信息
     * @return
     */
    public static User getCurrentUserInfo() {
        return  (User) session.getAttribute("userInfo1");
    }

    /**
     * 获取用户编号
     * @return
     */
    public static int getCurrentUserId() {
        User user = (User) session.getAttribute("userInfo");
        return  user.getUser_id();
    }
    /**
     * 获取用户手机号
     * @return
     */

}
